﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using RealtReview.DataAccess.Entities;
using RealtReview.DataAccess.Interfaces;
using RealtReview.DataAccess.SearchParameters;

namespace RealtReview.DataAccess.Repositories
{
    public class ReviewRepository : Repository<Review>, IReviewRepository
    {
        public ReviewRepository(DbContext context) : base(context)
        {
        }


        public IEnumerable<Review> Search(ReviewSearchParameters parameters)
        {
            return DbSet.AsEnumerable();
            //    .Get(ParametersParser.GetReviewPredicate(searchParameters))
            //    .Select(y =>
            //    {
            //        var json = Serializer.ToObject<ReviewViewModel>(y.OptionalParameters);
            //        return new ReviewListViewModel
            //        {
            //            Id = y.Id,
            //            Description = json?.Description,
            //            Price = y.Price,
            //            Status = y.Status,
            //            Latitude = y.Apartment.Address.Latitude,
            //            Longitude = y.Apartment.Address.Longitude
            //        };
            //    });
            //return items.ToList();
        }
    }
}
